package cn.tony.game.super_tank;

import java.awt.Graphics;
import java.util.Random;

public class Boomshakalaka extends Drawable {

	@Override
	public void syncLocation(Drawable relative) {
		x = relative.x;
		y = relative.y;
		w = h = 20;
		isNotCheckHit = true;
	}

	static Random random = new Random();

	private int frame = 0;

	@Override
	public void draw(Graphics g) {
		if (frame > Game.BOOMLIFE) {
			isAlive = false;
			return;
		}

		for (int i = 0; i < 1 + frame; i++) {
			int xoffset = random.nextInt(10) >= 5 ? random.nextInt(w * Game.BOOMD) : 0 - random.nextInt(w * Game.BOOMD);
			int yoffset = random.nextInt(10) >= 5 ? random.nextInt(h * Game.BOOMD) : 0 - random.nextInt(h * Game.BOOMD);
			g.drawImage(MediaUtils.boom, x + xoffset, y + yoffset, w, h, null);
		}

		frame++;
	}

	@Override
	public boolean isHit(Drawable d) {
		return false;
	}

}
